package com.kata.chapter6;

/**
 * Created by Solidsnake on 2014/11/20.
 */
public class FileReadProcess {

    private IFileReader fileReader = null;

    public FileReadProcess(IFileReader fileReader) {
        this.fileReader = fileReader;
    }

    public byte[] readFile() {
        if(this.fileReader.hasBefore()) {
            this.fileReader.before();
        }
        this.fileReader.read();
        if(this.fileReader.hasAfter()) {
            this.fileReader.after();
        }
        return fileReader.getContext();
    }
}
